package com.wcsy.myblog.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcsy.myblog.dao.AttentionMapper;
import com.wcsy.myblog.entity.Attention;
import com.wcsy.myblog.entity.User;
import com.wcsy.myblog.service.IAttentionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

@Service
public class AttentionServiceImpl extends ServiceImpl<AttentionMapper, Attention> implements IAttentionService {
    @Autowired
    private AttentionMapper attentionMapper;

    @Override
    public void insertAttontion(Attention attention) {
        attentionMapper.insertAttontion(attention);
    }

    @Override
    public Boolean selectUserAttention(int userId,int userIds) {
        Attention attention = attentionMapper.selectOne(new QueryWrapper<Attention>()
                .eq("attention_id", userId)
                .eq("user_id",userIds));
        if (attention!=null){
            return true;
        }
        return false;
    }

    @Override
    public void deleteAttontion(int id) {
        attentionMapper.deleteAttontion(id);
    }


}
